<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<fmt:requestEncoding value="utf-8" />
<html>
<head>
<title>List</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/main.css" />
<style type="text/css">

tr, td {
	border: none;
}

.commentBox {
	background-color:#eeeeee;
	border:0;
	padding:6px 15px;
	border-radius:26px
}

</style>
<script type="text/javascript">
<<<<<<< .mine
function getComments(num) {

	submit("getComments/(num).do");	
}

=======
>>>>>>> .r48
function submit(frm) {
	frm.submit();
}
</script>
</head>
<body style="overflow: auto">
<sec:authentication var="principal" property="principal" />
	<table style="border-collapse: collapse;">
		<c:forEach var="board" items="${requestScope.board}">
			<c:if test="${not empty board}">
				<tr>
					<td width="100px" />
					<td width="50px" />
					<td width="450px" />
					
				</tr>
				<tr>
					<td align="right" valign="top">
					<c:if test="${board.username != principal.username }">
					<a href="imageView.do?num=${board.num}">${board.username}</a> <!-- todo 프로필로 수정 -->
					</c:if>
					</td>
<<<<<<< .mine
					<form action="getComments/${board.num}.do">
					<td colspan="2" rowspan="2"><a href="imageView.do?num=${board.num}"><img width="500" src="imageShow/${board.num}.do" /></a></td>
					</form>
=======
					<td colspan="2" rowspan="2"><a href="imageView.do?num=${board.num}"><img width="500" src="imageShow/${board.num}.do" onload=""/></a></td>
>>>>>>> .r48
				</tr>
				<tr>
					<td align="right" valign="bottom">
					<c:if test="${board.username == principal.username }">
						<a href="imageEdit.do?num=${board.num}">
						<img src="img/edit.png"/></a> 
						<a href="imageDelete.do?num=${board.num}" onclick="return confirm('정말로 삭제하시겠습니까?')">
						<img src="img/delete.png"/></a> 
					</c:if>
					</td>
				</tr>
				<div id="commentsList" >
<<<<<<< .mine
				
				<c:forEach var="comments" items="${requestScope.comment}">
=======
				<c:forEach var="comments" items="${requestScope.commentsList}">
>>>>>>> .r48
				<tr>
					<td>${comments.username}</td>
					<td colspan="2">${comments.comment}</td>
				</tr>
				</c:forEach>
				</div>
				<tr>				
					<td />
					<td colspan="2" align="right">
					<form action="writeComment/${board.num}.do" >
					<input type="text" name="comment" class="commentBox" size="75%" placeholder="comment" onkeydown="javascript:submit(this.form);" />
					</form>
					</td>
				</tr>
			</c:if>
		</c:forEach>

	</table>



</body>
</html>